import 'package:distribution_mall_flutter/constant/cf_constant.dart';
import 'package:distribution_mall_flutter/generated/l10n.dart';
import 'package:distribution_mall_flutter/pages/order/widgets/address_card.dart';
import 'package:distribution_mall_flutter/utils/common_widget.dart';
import 'package:distribution_mall_flutter/widgets/card.dart';
import 'package:distribution_mall_flutter/widgets/goods_item_tile.dart';
import 'package:distribution_mall_flutter/widgets/icon_button.dart';
import 'package:distribution_mall_flutter/widgets/ink_well_view.dart';
import 'package:distribution_mall_flutter/widgets/navigation_item.dart';
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';

class PromoCard extends StatelessWidget {
  const PromoCard({super.key});

  Widget codeListRender() {
    return Container(
      margin: const EdgeInsets.only(top: EdgeConstant.edge10),
      decoration: const BoxDecoration(
        color: ColorConstant.grey246,
        borderRadius: BorderRadius.all(Radius.circular(RadiusConstant.edge8)),
      ),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  EPIconButton(
                    onPressed: () {},
                    icon: const Icon(
                      Icons.close,
                      size: 14,
                      color: ColorConstant.grey153,
                    ),
                  )
                ],
              )
            ],
          )
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return EPCard(
      margin: const EdgeInsets.fromLTRB(
          EdgeConstant.edge10, EdgeConstant.edge10, EdgeConstant.edge10, 0),
      padding: const EdgeInsets.symmetric(
          vertical: EdgeConstant.edge15, horizontal: EdgeConstant.edge10),
      child: Column(
        children: [
          CommonTextWidget.titleText(
              text: S.of(context).promo,
              icon: EPIconButton(
                onPressed: () {},
                icon: const Icon(
                  Icons.error_outline_outlined,
                  size: 12,
                  color: ColorConstant.grey195,
                ),
              )),
          Container(
            height: 37,
            padding: const EdgeInsets.fromLTRB(EdgeConstant.edge5,
                EdgeConstant.edge3, EdgeConstant.edge3, EdgeConstant.edge3),
            margin: const EdgeInsets.only(top: EdgeConstant.edge10),
            decoration: BoxDecoration(
              color: ColorConstant.grey246,
              borderRadius: BorderRadius.circular(RadiusConstant.edge8),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Expanded(
                    child: TextField(
                  controller: TextEditingController(text: '1123123122321'),
                  keyboardType: TextInputType.number,
                  textAlign: TextAlign.left,
                  cursorWidth: 0.5,
                  cursorHeight: 10,
                  textAlignVertical: TextAlignVertical.center,
                  decoration: null,
                  style: const TextStyle(
                      fontSize: FontConstant.f13, // 设置字体大小为20
                      color: Color.fromRGBO(61, 59, 59, 1)),
                  onChanged: (str) {
                    // int.tryParse(str) ?? 0;
                  },
                )),
                CommonBtnWidget.transparentBtn(
                    onPressed: () {},
                    height: 30,
                    type: GFButtonType.solid,
                    text: S.of(context).useCode,
                    borderSide: const BorderSide(
                        color: ColorConstant.primaryColor, width: 0.9),
                    textStyle: const TextStyle(
                        color: ColorConstant.primaryColor,
                        fontSize: FontConstant.f13))
              ],
            ),
          ),
          codeListRender()
        ],
      ),
    );
  }
}
